package org.session.dao.impl;

import javax.ejb.Stateless;
import java.util.List;
import javax.ejb.Local;
import javax.ejb.Remote;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.session.dao.FilesDao;
import org.session.dao.PatientDao;
import org.entity.Files;
import org.entity.Series;

/**
 * Session Bean implementation class FilesDaoImpl
 */
@SuppressWarnings("unused")
@Stateless
@Local(FilesDao.class)
@Remote(FilesDao.class)
public class FilesDaoImpl implements FilesDao {

	@PersistenceContext
	private EntityManager em;
	
    /**
     * Default constructor. 
     */
    public FilesDaoImpl() {
        // TODO Auto-generated constructor stub
    }

	/* (non-Javadoc)
	 * @see org.session.dao.FilesDao#findAllFiles()
	 */
	@SuppressWarnings("unchecked")
	public List<Files> findAllFiles() {
		return em.createQuery("select file from Files file").getResultList();
	}

	/* (non-Javadoc)
	 * @see org.session.dao.FilesDao#findFiles(java.lang.Integer)
	 */
	public Files findFiles(Integer pk) {
		return em.find(Files.class, pk);
	}

	/* (non-Javadoc)
	 * @see org.session.dao.FilesDao#update(org.entity.Files)
	 */
	public void update(Files files) {
		em.merge(files);
		
	}

    
}
